package com.jack.springcloud;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class ConfigController {

    @Value("${info}") //这里是bootstrap.yml加载config中心里的info字段对应的值。
    String configInfo;

    @Value("${server.port}")
    String port;

    @GetMapping("/configInfo")
    public String getConfigInfo(){
        return "port: "+port + " config: " +configInfo;
    }
}
